#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;
using db = double;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 510;

int n,m;
bool vis[2][N][N];
char s[N][N];

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    n = in,m = in;
    for(int i = 1;i <= n;i++) scanf("%s",s[i] + 1);
    for(int i = 1;i <= n;i++) {
		int pos = i & 1 ? m - 1 : 1;
		for(int j = 1;j <= pos;j++) vis[0][i][j] = 1;
		for(int j = pos + 1;j <= m;j++) vis[1][i][j] = 1;
		for(int j = 1;j <= m;j++) if(s[i][j] == '#') vis[0][i][j] = vis[1][i][j] = 1;
    }
    for(int i = 1;i <= n;i++,puts("")) for(int j = 1;j <= m;j++) printf(vis[0][i][j] ? "#" : ".");
    for(int i = 1;i <= n;i++,puts("")) for(int j = 1;j <= m;j++) printf(vis[1][i][j] ? "#" : ".");
    return 0;
}
